import api from './api'

/**
 * 刷新默认数据库元数据
 */
export const refreshDefaultMetadata = async () => {
  try {
    const response = await api.post('/api/metadata/refresh/default')
    return response.data
  } catch (error) {
    throw new Error(error.response?.data?.message || '刷新元数据失败')
  }
}

/**
 * 清除特定连接的元数据缓存
 * @param {Number} connectionId - 数据库连接ID
 */
export const clearConnectionMetadata = async (connectionId) => {
  try {
    const response = await api.post(`/api/metadata/clear/${connectionId}`)
    return response.data
  } catch (error) {
    throw new Error(error.response?.data?.message || '清除元数据缓存失败')
  }
} 